package fr.fort.lycee.spring.businesssImpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import fr.fort.lycee.spring.businesss.IBusinessRole;
import fr.fort.lycee.spring.daoImpl.DaoRoleImpl;
import fr.fort.lycee.spring.entities.Role;

@Service("BusinessRole")
@Transactional
public class BusinessRoleImpl implements IBusinessRole {
	@Autowired
	private DaoRoleImpl daoRole;

	public Integer save(Role role) {
		Integer id = daoRole.save(role);
		return id;
	}

	public void update(Role role) {
		daoRole.update(role);
	}

	public void delete(Role role) {
		daoRole.delete(role);
	}

	public Role findById(int id) {
		Role retour = daoRole.findById(id);
		return retour;
	}

	@Override
	public List<Role> findAll() {
		List<Role> retour = new ArrayList<>();
		retour = daoRole.findAll();
		return retour;
	}
}
